package com.example.loginprojectbackend.mapper;

import com.example.loginprojectbackend.pojo.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface UserMapper {
    /**
     * 通过用户名和密码查询对应用户
     *
     * @param user
     * @return
     */
    User getByNameAndPassword(User user);

    @Select("select * from user where email=#{email}" )
    User getByEmail(String email);
    @Update("update user set password=#{password} where email=#{email}")
    int resetPasswordByEmail(@Param("password") String password, @Param("email") String email);

    int resetInformation(@Param("password") String password, @Param("jobNumber") String jobNumber,@Param("email") String email,@Param("first") Integer first);

    @Select("select name,job_number from user")
    List<User> getAllUser();

}
